//
//  MvTableViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MvTableViewCell.h"

@implementation MvTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imgView];
        self.nameLabel = [[UILabel alloc] init];
        self.nameLabel.font = [UIFont systemFontOfSize:22];
        [self.contentView addSubview:self.nameLabel];
        self.singerNameLabel = [[UILabel alloc] init];
        self.singerNameLabel.font = [UIFont systemFontOfSize:17];
        self.singerNameLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.singerNameLabel];
        
        self.timeLabel = [[UILabel alloc] init];
        self.timeLabel.font = [UIFont systemFontOfSize:17];
        self.timeLabel.textColor = [UIColor whiteColor];
        [self.imgView addSubview:self.timeLabel];
        
            }
    
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    CGFloat w = self.contentView.frame.size.height - 10;
    self.imgView.frame = CGRectMake(20, 5, w * 2, w);
    
    self.timeLabel.frame = CGRectMake(0, self.imgView.frame.size.height - 30, 100, 30);
    
    [self.timeLabel sizeToFit];
    self.timeLabel.frame = CGRectMake(self.imgView.frame.size.width - self.timeLabel.frame.size.width - 10, self.timeLabel.frame.origin.y, self.timeLabel.frame.size.width, self.timeLabel.frame.size.height);
    
    self.nameLabel.frame = CGRectMake(CGRectGetMaxX(self.imgView.frame) + 15, 20, self.contentView.frame.size.width - CGRectGetMaxX(self.imgView.frame) - 35, 30);
    self.singerNameLabel.frame = CGRectMake(self.nameLabel.frame.origin.x, CGRectGetMaxY(self.nameLabel.frame)+10, self.nameLabel.frame.size.width, 25);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
